/*
 * Copyright 2016-2021 Pnoker. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *     http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.xj.center.data.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xj.common.bean.point.PointValue;
import com.xj.common.dto.ControlInfoDto;
import com.xj.common.dto.PointValueDto;
import com.xj.common.model.ControlInfo;

import java.util.List;

/**
 * @author pnoker
 */
public interface ControlInfoService {
  //下发控制指令
  String sendCtl(ControlInfo controlInfo);

  /**
   * 新增 ControlInfo
   */
  void saveControlInfoToRedis(ControlInfo controlInfo);

  /**
   * 更新 ControlInfo
   */
  void updateControlInfoToRedis(ControlInfo controlInfo);


  /**
   * 保存 ControlInfo
   */
  void saveControlInfoToMongo(ControlInfo controlInfo);


  /**
   * 获取实时控制状态
   *
   * @param deviceId Device Id
   * @return PointValue Array
   */
  ControlInfo realtimeByDeviceId(Long deviceId);

  /**
   * 获取实时控制状态
   *
   * @return ControlInfo
   */
  ControlInfo realtimeByCtlId(String handle);

  /**
   * 获取一个设备最新的控制数据集合
   *
   * @param deviceId Device Id
   * @return ControlInfo Array
   */
  List<ControlInfo> latest(Long deviceId);


  /**
   * 获取带分页、排序
   *
   * @param controlInfoDto ControlInfoDto
   * @return Page<ControlInfo>
   */
  Page<ControlInfo> list(ControlInfoDto controlInfoDto);

}
